package com.ttloner.springboot.mapper;

import com.ttloner.springboot.model.MyUser;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author TTLoner
 * @date 2021/7/17 20:00
 * @description
 */
@Mapper
public interface MyUserMapper {
    @Insert("insert into my_user values(null,#{username},#{password},#{p_addr},#{gender},#{birth})")
    public void insert(MyUser myUser);

    @Select("select * from my_user where pid=#{pid}")
    public MyUser selectById(int pid);

    @Select("select * from my_user")
    public List<MyUser> selectAll();

    @Update("Update my_user set username=#{username}," +
            "password=#{password}," +
            "p_addr=#{p_addr}," +
            "gender=#{gender}," +
            "birth=#{birth} where pid=#{pid}")
    public void update(MyUser myUser);
    @Delete("delete from my_user where pid=#{pid}")
    public void deleteById(int pid);
}
